package com.itany.corejava.code08_常用类.泛型;

/**
 * @author 石小俊
 * @date 2023年05月04日 11:17
 */
public class Test02_泛型接口 {
    public static void main(String[] args) {
        Person person1 = new Person("admin", 20);
        Person person2 = new Person("jack", 21);
        if (person1.compareTo(person2) > 0) {
            System.out.println(person1.getName() + "比" + person2.getName() + "年龄大");
        } else if (person1.compareTo(person2) == 0) {
            System.out.println(person1.getName() + "与" + person2.getName() + "一样大");
        } else {
            System.out.println(person1.getName() + "比" + person2.getName() + "年龄小");
        }

        User user1 = new User("admin", 20);
        User user2 = new User("alice", 18);
        if (user1.compareTo(user2) > 0) {
            System.out.println(user1.getName() + "比" + user2.getName() + "的姓名长度长");
        } else if (user1.compareTo(user2) == 0) {
            System.out.println(user1.getName() + "与" + user2.getName() + "的姓名长度一样长");
        } else {
            System.out.println(user1.getName() + "与" + user2.getName() + "的姓名长度短");
        }

    }
}
